<template>
	<view class="page-fade-in" :style="{opacity: pageOpc}">
		<template v-if="pageOpc">
			<view class="content">
				<view class="head-box flexWrap">
					<view class="date-box flexWrapNo">
						<image src="/static/index/calendar.png" class="calendar-icon"></image>
						<picker mode="date"  :value="starTime" @change="bindDateChange" :end="date">
							<view class="select-input">{{starTime}}</view>
						</picker>
					</view>
					<view class="update-date">更新时间 2021-23-23 20:23</view>
				</view>
				<view class="total">预警店铺5个</view>
				<view class="warn-cont">
					<view class="warn-item" v-for="item in 4">
						<view class="warn-info-text">
							店铺：乒个乓乒乓球-理想中心店
						</view>
						<view class="warn-info-text">
							日期：2024-09-17
						</view>
						<view class="warn-info-text">
							预警：日收入不足100.00元<text>连续预警2天</text>
						</view>
					</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			const currentDate = this.getDate({
				format: true
			})
			const starDate = this.getDate('start')
			return {
				pageOpc:0,
				starTime: starDate,
				date: currentDate,
			}
		},
		onLoad() {
			
		},
		onReady(){
			setTimeout(() => {
				this.pageOpc=1
			}, 100)
		},
		methods: {
			// 获取时间
			getDate(type) {
				const date = new Date();
				if (type === 'start') {
					date.setDate(date.getDate());
				}
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			// 选择时间
			bindDateChange(e) {
				this.starTime = e.target.value
			},
		}
	}
</script>

<style lang="scss">
	.head-box{
		padding: 0 34upx;
		.date-box{
			font-size: 32upx;
			font-family: PingFang SC;
			font-weight: 500;
			line-height: 60upx;
			color: #FFFFFF;
			.calendar-icon{
				width: 48upx;
				height: 48upx;
				margin-right: 24upx;
			}
		}
		.update-date{
			font-size: 24upx;
			font-weight: 500;
			color: #fc750d;
		}
	}
	.total{
		color:rgba(255, 255, 255, .8);
		font-size: 30upx;
		margin: 10upx 0;
		padding: 0 34upx;
	}
	.warn-cont{
		padding:34upx;
		border-top: 1upx solid #FFFFFF;
		.warn-item{
			padding-bottom: 20upx;
			margin-bottom: 20upx;
			border-bottom: 1upx solid #36355E;
			.warn-info-text{
				font-size: 24upx;
				font-family: PingFang SC;
				font-weight: 400;
				line-height: 40upx;
				color: #FFFFFF;
				text{
					font-size: 24upx;
					font-weight: 500;
					color: #fc750d;
					margin-left: 20upx;
				}
			}
		}
	}
</style>
